package cn.gs.common.dto;

import cn.gs.common.enums.StatusEnums;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author gs
 * @date 2020/1/9
 */
@Data
@AllArgsConstructor
public class R {
    private Integer code;
    private String msg;
    private Object date;

    public R(Integer code, String message) {
        this.code = code;
        this.msg = message;
    }

    public R(StatusEnums enums){
        this.code = enums.getCode();
        this.msg = enums.getMessage();
    }

    public R(StatusEnums enums,Object o){
        this.code = enums.getCode();
        this.msg = enums.getMessage();
        this.date = o;
    }

    public static R success(Object o){
        return new R(StatusEnums.SUCCESS,o);
    }
}
